<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});
Route::get('/test','TestController@index');
Route::group(['prefix' => 'manage'], function () {
    // 无需验证登录
    Route::get('/login', 'Adminer\PublicController@login')->name("login");
    Route::post('/login', 'Adminer\PublicController@authenticate')->name("login");

    // 验证登录
    Route::group(['middleware' => 'manage.auth'], function () {
        Route::get('/logout', 'Adminer\PublicController@logout')->name('logout'); //退出
        Route::get('/reset', 'Adminer\PublicController@reset')->name('resetpass'); //退出
        Route::post('/reset', 'Adminer\PublicController@userUpdate')->name('resetpass_do'); //退出
        Route::get('', 'Adminer\HomeController@index')->name('home.index'); //后台首页
        // 权限功能
        Route::resource('purview', 'Adminer\PurviewController');
        Route::post('purview/sort', 'Adminer\PurviewController@sort')->name('purview.sort'); //权限管理排序
        // 角色功能
        Route::resource('role', 'Adminer\RoleController');
        Route::post('role/sort', 'Adminer\RoleController@sort')->name('role.sort'); //权限管理排序
        Route::get('role/assign/{id}', 'Adminer\RoleController@assign')->name('role.assign'); //权限管理排序
        Route::post('role/assign/{id}', 'Adminer\RoleController@assign_do')->name('role.assign_do'); //权限管理排序
        // 后台帐号管理
        Route::resource('admin', 'Adminer\AdminController');
        // 系统日志
        Route::resource('adminlog', 'Adminer\AdminLogController');
    });

});
